﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GA.Shared.Interfaces;
using System.Windows;
using System.Runtime.Serialization;
using System.Windows.Data;

namespace GA.Shared.Objects
{
    public class Item : LinkedDependencyObject
    {
        /// <summary>
        /// Identifies the Id Property.
        /// </summary>
        public static readonly DependencyProperty IdProperty =
            RegisterProperty(
                "Id",
                typeof(int),
                typeof(Item),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the GameId Property.
        /// </summary>
        public static readonly DependencyProperty GameIdProperty =
            RegisterProperty(
                "GameId",
                typeof(int),
                typeof(Item),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the ItemTypeId Property.
        /// </summary>
        public static readonly DependencyProperty ItemTypeIdProperty =
            RegisterProperty(
                "ItemTypeId",
                typeof(int),
                typeof(Item),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the ItemType Property.
        /// </summary>
        public static readonly DependencyProperty ItemTypeProperty =
            RegisterProperty(
                "ItemType",
                typeof(ItemType),
                typeof(Item),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the Quantity Property.
        /// </summary>
        public static readonly DependencyProperty QuantityProperty =
            RegisterProperty(
                "Quantity",
                typeof(int),
                typeof(Item),
                new PropertyMetadata(0));

        /// <summary>
        /// Identifies the CurrentDurability Property.
        /// </summary>
        public static readonly DependencyProperty CurrentDurabilityProperty =
            RegisterProperty(
                "CurrentDurability",
                typeof(int),
                typeof(Item),
                new PropertyMetadata(0));

        /// <summary>
        /// Identifies the MaxDurability Property.
        /// </summary>
        public static readonly DependencyProperty MaxDurabilityProperty =
            RegisterProperty(
                "MaxDurability",
                typeof(int),
                typeof(Item),
                new PropertyMetadata(0));

        /// <summary>
        /// Identifies the IsEquipped Property.
        /// </summary>
        public static readonly DependencyProperty IsEquippedProperty =
            RegisterProperty(
                "IsEquipped",
                typeof(bool),
                typeof(Item),
                new PropertyMetadata(false));

        /// <summary>
        /// Gets or sets the Id.
        /// </summary>
        
        public int Id
        {
            get { return (int)SafeGetValue(IdProperty); }
            set { SafeSetValue(IdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Game Id.
        /// </summary>
        
        public int GameId
        {
            get { return (int)SafeGetValue(GameIdProperty); }
            set { SafeSetValue(GameIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the ItemType Id.
        /// </summary>
        
        public int ItemTypeId
        {
            get { return (int)SafeGetValue(ItemTypeIdProperty); }
            set { SafeSetValue(ItemTypeIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the ItemType.
        /// </summary>
        
        public ItemType ItemType
        {
            get { return (ItemType)SafeGetValue(ItemTypeProperty); }
            set { SafeSetValue(ItemTypeProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Quantity.
        /// </summary>
        
        public int Quantity
        {
            get { return (int)SafeGetValue(QuantityProperty); }
            set { SafeSetValue(QuantityProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Current Durability.
        /// </summary>
        
        public int CurrentDurability
        {
            get { return (int)SafeGetValue(CurrentDurabilityProperty); }
            set { SafeSetValue(CurrentDurabilityProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Max Durability.
        /// </summary>
        
        public int MaxDurability
        {
            get { return (int)SafeGetValue(MaxDurabilityProperty); }
            set { SafeSetValue(MaxDurabilityProperty, value); }
        }

        /// <summary>
        /// Gets or sets if this item is equipped or not.
        /// </summary>
        
        public bool IsEquipped
        {
            get { return (bool)SafeGetValue(IsEquippedProperty); }
            set { SafeSetValue(IsEquippedProperty, value); }
        }

        public Item()
        {
        }

        public Item(LinkedDependencyObject baseObject)
            : base(baseObject)
        {
        }

        public Item(LinkedDependencyObject baseObject, BindingMode bindingMode)
            : base(baseObject, bindingMode)
        {
        }
    }
}
